//
//  MePhotoCollectionViewCell.m
//  QT
//
//  Created by 甘世清 on 2025/1/4.
//

#import "MePhotoCollectionViewCell.h"

@implementation MePhotoCollectionViewCell
- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        self.layer.masksToBounds = YES;
        [self SQ_UIViewForSelfView];
    }
    return self;
}
/// 添加ui
-(void)SQ_UIViewForSelfView
{
    self.contentView.layer.cornerRadius = 8;
    self.contentView.clipsToBounds = YES;
    self.contentView.layer.masksToBounds = YES;
    self.contentView.backgroundColor =UIColor.clearColor;
    
    [self.contentView addSubview:self.bgImage];
    [self.bgImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.contentView);
    }];
    
}
- (void)setModel:(PhotoModel *)model{
    _model = model;
    self.bgImage.hidden = NO;
    self.bgImage.image = model.addImage;
    if (model.url) {
        [self.bgImage sd_setImageWithURL:SQURLImage(model.url)];
    }
}
- (UIImageView *)bgImage{
    if (!_bgImage) {
        _bgImage = [[UIImageView alloc]init];
        _bgImage.contentMode = UIViewContentModeScaleAspectFill;
        _bgImage.clipsToBounds = YES;
    }
    return _bgImage;
}
@end
